package com.yanqu.road.server.manger;

import com.yanqu.road.entity.servercenter.GameEditLimit;
import com.yanqu.road.logic.bussiness.servercenter.ServerBussiness;
import com.yanqu.road.server.TempMgr;
import com.yanqu.road.utils.ConfigHelper;

import java.util.HashMap;
import java.util.Map;

public class GameEditLimitMgr extends TempMgr {
    private static Map<Integer, GameEditLimit> gameEditLimitMap = new HashMap<>();
    @Override
    public boolean init() throws Exception {
        return reload();
    }

    @Override
    public boolean reloadConfig() throws Exception {
        int channelId = ServerListMgr.getChannelId(ConfigHelper.getLong("serverId"));
        gameEditLimitMap = ServerBussiness.getGameEditLimitMap(channelId);
        return true;
    }

    @Override
    public boolean reloadData() throws Exception {
        return true;
    }

    @Override
    public boolean stop() {
        return false;
    }

    public static GameEditLimit getGameEditLimit(int commandCode){
        return gameEditLimitMap.get(commandCode);
    }
}
